// 用户相关请求模块
import request from '../utils/quest'

// 导出请求模块
export const login = (data) => {
  return request({
    method: 'post',
    url: '/v1_0/authorizations',
    data
  })
}
// 导出发送验证码模块
export const sendSms = (tel) => {
  return request.get('/v1_0/sms/codes/' + tel)
}

// 导出获取用户自己info的模块
export const getInfoMe = (data) => {
  return request({
    method: 'GET',
    url: '/v1_0/user',
    headers: { Authorization: 'Bearer ' + data.token }
  })
}

// 导出获取用户自己频道列表
export const getMyChannels = () => {
  return request.get('/v1_0/user/channels')
}

// 导出关注用户api
export const followings = (data) => {
  return request.post('/v1_0/user/followings', {
    target: data
  })
}

// 导出取消关注用户api
export const quitFollowings = (data) => {
  return request.delete(`/v1_0/user/followings/${data}`)
}

// 获取用户个人资料api
export const getuser = () => {
  return request.get('/v1_0/user/profile')
}

// 编辑用户个人资料api
export const edituser = (data) => {
  return request.patch('/v1_0/user/profile', data)
}

// 编辑用户照片资料（头像、身份证照片）
export const getImgUrl = (data) => {
  return request.patch('/v1_0/user/photo', data)
}
